package idp.utils;

import java.util.Calendar;

public class DateFormatter
{
	public static String formatTime(long time)
	{
		Calendar c = Calendar.getInstance();
		c.setTimeInMillis(time);
		return c.get(c.DAY_OF_MONTH)+"-"+c.get(c.MONTH)+" "+c.get(c.HOUR_OF_DAY)+":"+formatNumber(c.get(c.MINUTE));
	}
	
	public static String formatInterval(long interval)
	{
		interval = interval/1000;
		int minutes = Math.round(interval/60);
		int seconds = Math.round(interval-(minutes*60));
		return minutes+":"+formatNumber(seconds);
	}
	
	public static String formatNumber(int number)
	{
		if(number < 10)
			return "0"+number;
		else
			return Integer.toString(number);
	}
}
